import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author LKQ
 * @date 2022/2/1 15:25
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        String[] words = {"omk"};
        solution.findWords(words);
    }
    public String[] findWords(String[] words) {
        String s1 = "qwertyuiop", s2 = "asdfghjkl", s3 = "zxcvbnm";
        List<String> list = new ArrayList<>();
        for (String word : words) {
            int n = word.length();
            String first = word.substring(0, 1).toLowerCase();
            String temp = s3;
            if (s1.contains(first)) {
                temp = s1;
            }else if (s2.contains(first)) {
                temp = s2;
            }
            boolean find = true;
            for (int i = 1; i < n; i++) {
                if (!temp.contains(word.substring(i, i + 1).toLowerCase())) {
                    find = false;
                    break;
                }
            }
            if (find) {
                list.add(word);
            }
        }
        return list.toArray(new String[0]);
    }
}
